home *** CD-ROM | disk | FTP | other *** search
- /* strtod.c, from p.181 of Turbo C Bible */
- /* Converts a string to a double-precision floating-point value. */
- #include <stdio.h>
- #include <stdlib.h>
- main()
- {
- char input[80], *stop_at;
- double value;
- printf("Enter a number followed by other characters\n");
- gets(input);
- value = strtod(input, &stop_at); /* Now convert the number to */
- printf("Value = %g\n"
- "Stopped at: %s\n", value, stop_at); /* internal value */
- }